package route

import (
	"core/repo"
	"framework/node"
	"game/handler"
	"game/logic"
)

func Register(r *repo.Manager) node.LogicHandler {
	handlers := make(node.LogicHandler)
	//卡牌游戏
	um := logic.NewCardManager()
	cardHandler := handler.NewCardHandler(r, um)
	handlers["cardHandler.roomList"] = cardHandler.RoomList     //房间列表
	handlers["cardHandler.createRoom"] = cardHandler.CreateRoom //创建房间
	handlers["cardHandler.joinRoom"] = cardHandler.JoinRoom     //加入房间
	handlers["cardHandler.cardLog"] = cardHandler.CardLog       //游戏记录

	//游戏操作
	gameHandler := handler.NewGameHandler(r, um)
	handlers["gameHandler.roomMessageNotify"] = gameHandler.CardRoomMessageNotify //卡牌房间内操作
	handlers["gameHandler.gameMessageNotify"] = gameHandler.CardGameMessageNotify //卡牌游戏内操作
	return handlers
}
